<div class="row"> 
<small>
  <div class="span12">
   <div class="clearfix txtleft search" style="background-color:#f8f8f8; padding:10px; margin:10px 0px;" >  
       <form  name="form1"  method="get" class="form-horizontal" action="/<*$controller*>/class"> 
          机构:<select id="jigou" name="groups"  onchange="getSchool(this.value)"></select>
          校园:<select id="school" name="school"  onchange="getClass(this.value)"></select> 
          班级:<select id="class1" name="class" ></select>
          <input type="submit" class="btn btn-success"  value="查询"  >
          <input type="button" class="btn btn-success" value="清空查询" onclick="window.location='/user/class'" >
       </form>
       
	</div>	 
 
  	<div class="table_content">
		<div class="ta_top"></div>
		<div class="ta_in">
   <*if $result|@count neq 0*>  
       <div class="alert span7" style="margin-top:10px;">
      <strong>说明：</strong> 删除不存在的班级请在manage班级管理中进行。
    </div>

   <table cellpadding="0" cellspacing="0" class="table" style="clear:both">
			<tr> 
			<th style="width:15%;">所属机构</th> 
            <th style="width:20%;">所属校园</th> 
			<th style="width:10%;">班级名称</th>
			<th style="width:10%;">教师名称</th>
			<th style="width:8%;">登陆账号</th>
            <th style="width:10%;">登陆密码</th>
			<th style="width:5%;">锁定</th>
			<th style="width:5%;">推送</th>
            <th style="width:5%;">安装</th>
            <th style="width:20%;">操作</th>
			<th>&nbsp;</th>
		</tr> 
    <*foreach from=$result item=a key =key name=foo*>
		<tr> 
			<td><*$a.groupname*></td>
            <td><*$a.schoolname*></td>
			<td><*$a.classname*></td> 
			<td><*$a.teachername*></td> 
			<td><*$a.username*></td>
			<td><*$a.password*></td>
			<td><*if $a.islock eq 0*> &nbsp;<*else if $a.islock*><i class="icon-lock"></i><*/if*></td>
			<td><*if $a.canpull*><i class="icon-ok"></i><*else if $a.canpull eq 0*><i class="icon-remove"></i><*/if*></td> 
            <td><*if $a.isinstalled eq 0*>&nbsp;<*else if $a.isinstalled*><i class="icon-ok"></i><*/if*></td> 
            <td><a   role="button" class="btn btn-primary" data-toggle="modal" onclick="javascript:resetpassword(<*$a.teacherid*>,<*$a.classid*>,'<*$a.groupname_en*>','<*$pageNum*>')"><i class="icon-pencil icon-white"> </i> 初始化密码</a>&nbsp;&nbsp;&nbsp;&nbsp; <!-- button type="button" class="btn  btn-small" onclick="javascript:deleteit(<*$a.uid*>,'class')" ><i class="icon-trash"></i>删除</button --></td>
            <td>&nbsp;</td>
		</tr>
		<*/foreach*>
       <tr>
        	<td colspan="10"> <*$page*></td>
            <td>&nbsp;</td>
        </tr>
      <*else*>  
          <tr>
        	<td colspan="10"> 没有您要的结果,请改变你的搜索条件！</td>
            <td>&nbsp;</td>
        </tr> 
        
        <*/if*>
        </table>
        </div>
    <div class="ta_bottom"></div>
	  </div> 
    
    </div>
    </small>
</div>

<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript" > 
  window.onload=function(){
	 jigou(); 

	if('<*$groups*>' != ''){
		getSchool('<*$groups*>');
	}
	if('<*$school_id*>' != ''){
		getClass('<*$school_id*>');
	}

 } 
function jigou()
{  

	var url     = '/<*$controller*>/groups/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '';
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});

} 
function showResponse_course(originalRequest)
{
	{  //alert(originalRequest.responseText);  
		 document.all.form1.groups.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$groups*>' != ''){
			 jsSelectIsExitItem(document.all.form1.groups,'<*$groups*>');
	        } 
	 }

}  

function getSchool(a)
{  
	var url  = '/<*$controller*>/schoollist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_school});

} 
function showResponse_school(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.school.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$school_id*>' != ''){
				jsSelectIsExitItem(document.all.form1.school,'<*$school_id*>');
			}
	 } 
}  
function getClass(a)
{  
     
	var url  = '/<*$controller*>/classlist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_class});

} 
function showResponse_class(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.class.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$classid*>' != ''){
				jsSelectIsExitItem(document.all.form1.class,'<*$classid*>');
			}
	 } 
}  

 
function deleteit(id,type)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/id/'+id+'/type/'+type;
  }
}

function editit(id,type)
{
	/// alert(id);
	// alert(type);
 	window.location='/<*$controller*>/editclass/id/'+id;
}

function resetpassword(teacherid,classid,name,pageNum)
{  

   
 	window.location='/<*$controller*>/repassword/teacherid/'+teacherid+'/classid/'+classid+'/name/'+name+'/pageNum/'+pageNum;
	
	
	//+'/group/'+group+'/school/'+school+'/class/'+class
} 
 function jsSelectIsExitItem(objSelect, objItemValue) {
	//alert(objSelect.options.length);
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) { 
			objSelect.options[i].selected=true;
        	 break;
        }
    }
    return 1;
} 
 
 
</script>